import request from '@/utils/request'
import { encryptionData } from '@/utils/com'
import Qs from 'qs'

/* 获取示范案例管理列表 */
export function getCaseList(data) {
  return request({
    url: '/jcdGys/houseCase/pcPage',
    method: 'get',
    headers: encryptionData(data, '/houseCase/pcPage'),
    params: data
  })
}

/* 获取示范案例 */
export function getCaseDetailList(data) {
  return request({
    url: `/jcdGys/houseCase/get/${data.id}`,
    method: 'get',
    headers: encryptionData({}, `/houseCase/get/${data.id}`)
  })
}

/* 修改示范案例 */
export function updateCase(data) {
  return request({
    url: '/jcdGys/houseCase/update',
    method: 'post',
    headers: encryptionData(data, '/houseCase/update'),
    data: Qs.stringify(data)
  })
}

/* 添加示范案例 */
export function addCase(data) {
  return request({
    url: '/jcdGys/houseCase/save',
    method: 'post',
    headers: encryptionData(data, '/houseCase/save'),
    data: Qs.stringify(data)
  })
}

/* 删除示范案例 */
export function deleteCase(data) {
  return request({
    url: '/jcdGys/houseCase/delete',
    method: 'DELETE',
    headers: encryptionData(data, '/houseCase/delete'),
    data: Qs.stringify(data)
  })
}

/* 是否显示 */
export function updateShowStatus(data) {
  return request({
    url: '/jcdGys/houseCase/changeShowFlag',
    method: 'post',
    headers: encryptionData(data, '/houseCase/changeShowFlag'),
    data: Qs.stringify(data)
  })
}

/* 获取示范案例-查看案例详情列表 */
export function getCaseDetail(data) {
  return request({
    url: '/jcdGys/houseCase/caseDetail',
    method: 'get',
    headers: encryptionData(data, '/houseCase/caseDetail'),
    params: data
  })
}

/* 获取案例详情信息 */
export function getTableDetail(data) {
  return request({
    url: '/jcdGys/houseCase/caseDetail',
    method: 'get',
    headers: encryptionData(data, '/houseCase/caseDetail'),
    params: data
  })
}

/* 添加案例详情-表格 */
export function addTableDetail(data) {
  return request({
    url: '/jcdGys/designDiagram/save',
    method: 'post',
    headers: encryptionData(data, '/designDiagram/save'),
    data: Qs.stringify(data)
  })
}

/* 修改案例详情-表格 */
export function updateTableDetail(data) {
  return request({
    url: '/jcdGys/designDiagram/update',
    method: 'post',
    headers: encryptionData(data, '/designDiagram/update'),
    data: Qs.stringify(data)
  })
}

/* 删除案例详情 */
export function deleteTableDetail(data) {
  return request({
    url: `/jcdGys/designDiagram/delete/${data.id}`,
    method: 'DELETE',
    headers: encryptionData({}, '/deleteTableDetail'),
  })
}

/* 获取示范案例-查看案例详情列表 */
export function getCasePrice(data) {
  return request({
    url: '/jcdGys/casePrice/list',
    method: 'get',
    headers: encryptionData(data, '/casePrice/list'),
    params: data
  })
}

/* 修改案例详情-案例报价表单 */
export function addCasePrice(data) {
  return request({
    url: '/jcdGys/casePrice/save',
    method: 'post',
    headers: encryptionData(data, '/casePrice/save'),
    data: Qs.stringify(data)
  })
}

/* 修改案例详情-案例报价表单 */
export function updateCasePrice(data) {
  return request({
    url: '/jcdGys/casePrice/update',
    method: 'post',
    headers: encryptionData(data, '/casePrice/update'),
    data: Qs.stringify(data)
  })
}
